package org.wx.ormtest.init;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

/**
 * jdbc 连接 SPI
 * @description:
 * @author: wangxun
 * @createDate: 2022/1/14
 * @version: 1.0
 */
public class JdbcTest {
    public static void main(String[] args) throws Exception {
        /**
         * 在 com.mysql.cj.jdbc.Driver 类加载的时候就执行了 将自身注册到 DriverManager的registeredDrivers
         * 这样在getConnection中 调用驱动包中的Driver.connection
         *
         * ==
         */
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://node1.cn:3306/orm?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai", "root", "123456");

    }
}
